package com.dz.server.service.impl;

import com.dz.server.pojo.Atomic;
import com.dz.server.mapper.AtomicMapper;
import com.dz.server.service.AtomicService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dz
 * @since 2022-03-23
 */
@Service
public class AtomicServiceImpl extends ServiceImpl<AtomicMapper, Atomic> implements AtomicService {
    @Autowired
    private AtomicMapper atomicMapper;
    @Override
    public List<Atomic> getAtomics(String msg) {
        List<Atomic> atomics = new ArrayList<>();
        String[] split = msg.split(",");
        for (String s : split) {
            int i = Integer.parseInt(s);
            Atomic atomic = atomicMapper.selectById(i);
            atomics.add(atomic);
        }
        return atomics;
    }
}
